<template>
  <div class="tooltip">
    <i class="iconfont icon-help"></i>
    <div class="tooltip__text">
      <span>{{ text }}</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    text: {
      type: String,
      default: "",
    },
  },
};
</script>

<style lang="scss" scoped>
.tooltip {
  position: relative;
  display: flex;
  align-items: center;

  .iconfont {
    font-size: 18px;
    color: var(--color-content);
    margin-left: 3px;
    cursor: pointer;
  }

  &__text {
    visibility: hidden;
    position: absolute;
    left: 50%;
    bottom: 21px;
    background-color: var(--border-color);

    width: 280px;
    padding: 10px;
    border-radius: 8px;

    z-index: 1;
    opacity: 0;
    transition: opacity 0.5s;
    transition-delay: 0.1s;
    transform: translateX(-30%);
    word-break: keep-all;
    box-sizing: border-box;
    box-shadow: 2px 2px 13px 0px var(--color-dark);

    span {
      font-family: "Roboto Regular";
      font-style: normal;
      font-size: 14px;
      line-height: 18px;
      text-align: left;
      color: var(--color);
    }

    &::after {
      content: "";
      position: absolute;
      top: 100%;
      left: 30%;
      margin-left: -4px;
      border-width: 5px;
      border-style: solid;
      border-color: var(--border-color) transparent transparent transparent;
    }
  }

  &:hover &__text {
    visibility: visible;
    opacity: 1;
  }
}
</style>
